//
//  JingxuanCell.m
//  JingXuanTableView
//
//  Created by TianZhen on 16/4/6.
//  Copyright © 2016年 TianZhen. All rights reserved.
//
#import "UIImage+Extend.h"
#import "JingxuanScrollView.h"
#import "JingxuanModel.h"
#import "JingxuanCell.h"
#import "JingxuanIconView.h"

@interface JingxuanCell ()
/** 头像 */
@property (weak, nonatomic) IBOutlet JingxuanIconView *iconView;

/** 用户名称 */
@property (weak, nonatomic) IBOutlet UILabel *userName;

/** 发送时间 */
@property (weak, nonatomic) IBOutlet UILabel *time;

/** 等级图片 */
@property (weak, nonatomic) IBOutlet UIImageView *levelIcon;

/** 中间大图 */
@property (weak, nonatomic) IBOutlet UIImageView *bigImageView;

/** 多图片滚动View */
@property (weak, nonatomic) IBOutlet JingxuanScrollView *scrollView;

@end

@implementation JingxuanCell

- (void)setFrame:(CGRect)frame
{
    frame.size.height -= 8;
    [super setFrame:frame];
}

- (void)setModel:(JingxuanModel *)model
{
    _model = model;

    self.iconView.image = [UIImage circleImageWithName:model.icon];

    self.userName.text = model.userName;
    self.time.text = model.time;
    self.levelIcon.image = [UIImage imageNamed:@"level3"];

    // 设置大图
    self.bigImageView.image = model.images.firstObject;
    
    // 赋值滚动窗口图片
    self.scrollView.images = model.images;
    
    self.iconView.layer.cornerRadius = self.iconView.bounds.size.width*0.5;
}

// 关注按钮点击事件
- (IBAction)followBtn:(UIButton *)sender {
    NSLog(@" 点击了关注按钮 ");
}

- (void)awakeFromNib {
    // Initialization code
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
